-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Implement set_attribute
& set_class_attribute
nonfungibles trait functions for Uniques
pallet
#9206
Implement set_attribute
& set_class_attribute
nonfungibles trait functions for Uniques
pallet
#9206
Conversation
…ibles trait functions
Uniques
palletset_attribute
& set_class_attribute
nonfungibles trait functions for Uniques
pallet
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
frame/uniques/src/functions.rs
Outdated
} | ||
class_details.total_deposit.saturating_accrue(deposit); | ||
if deposit > old_deposit { | ||
T::Currency::reserve(&class_details.owner, deposit - old_deposit)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T::Currency::reserve(&class_details.owner, deposit - old_deposit)?; | |
T::Currency::reserve(&class_details.owner, deposit.saturating_sub(old_deposit))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion, done here 6fabf25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is NOT needed, and actually probably some additional overhead.
Note the check just 1 line above: deposit > old_deposit
This subtraction can never panic
please undo
frame/uniques/src/functions.rs
Outdated
if deposit > old_deposit { | ||
T::Currency::reserve(&class_details.owner, deposit - old_deposit)?; | ||
} else if deposit < old_deposit { | ||
T::Currency::unreserve(&class_details.owner, old_deposit - deposit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T::Currency::unreserve(&class_details.owner, old_deposit - deposit); | |
T::Currency::unreserve(&class_details.owner, old_deposit.saturating_sub(deposit)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion, done here 6fabf25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo
frame/uniques/src/functions.rs
Outdated
let mut deposit = Zero::zero(); | ||
if !class_details.free_holding && maybe_check_owner.is_some() { | ||
deposit = T::DepositPerByte::get() | ||
.saturating_mul(((key.len() + value.len()) as u32).into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.saturating_mul(((key.len() + value.len()) as u32).into()) | |
.saturating_mul((key.len().saturating_add(value.len()) as u32).into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion, done here 6fabf25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one i think is okay, but would want you to look closer before actually making this change
and then a test
This looks okay, but I suggest we do not increase the expectations of the Remember that we should not assume all (or even most) NFT systems will require some on-chain metadata. |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Implements missing
set_attribute
,set_class_attribute
nonfungibles
Mutate
trait functions foruniques
palletRelates to #9208